#include <iostream>
#include <string>
#include <vector>

struct Book {
    std::string title;          // 书名
    std::string author;         // 作者
    std::string publicationDate; // 出版年月
    bool isBorrowed;            // 借出状态
};

int main() {
    int n; // 存储书籍数量
    std::cout << "请输入要录入的书籍数量: ";
    std::cin >> n;
    std::cin.ignore(); // 忽略换行符

    std::vector<Book> books(n); // 创建一个存放图书信息的数组

    // 读入书籍信息
    for (int i = 0; i < n; i++) {
        std::cout << "请输入第 " << (i + 1) << " 本书的信息：" << std::endl;

        std::cout << "书名: ";
        std::getline(std::cin, books[i].title);

        std::cout << "作者: ";
        std::getline(std::cin, books[i].author);

        std::cout << "出版年月: ";
        std::getline(std::cin, books[i].publicationDate);
        
        std::cout << "借出状态 (1:借出, 0:未借出): ";
        int borrowed;
        std::cin >> borrowed;
        books[i].isBorrowed = (borrowed == 1);
        std::cin.ignore(); // 忽略换行符
    }

    // 打印书籍信息
    std::cout << "\n录入的书籍信息如下：" << std::endl;
    for (const auto& book : books) {
        std::cout << "书名: " << book.title << std::endl;
        std::cout << "作者: " << book.author << std::endl;
        std::cout << "出版年月: " << book.publicationDate << std::endl;
        std::cout << "借出状态: " << (book.isBorrowed ? "借出" : "未借出") << std::endl;
        std::cout << "---------------------" << std::endl;
    }

    return 0;
}
